<template>
	<view class="u-content">
		<view class="push-header">
			<text class="push-title" v-text="pushHistory.title"></text>
		</view>
		<view class="push-header">
			<text class="push-msg" v-text="pushHistory.creatorName"></text>
			<text class="push-msg" v-text="pushHistory.createTime"></text>
		</view>
		<view class="push-header">
			<u-parse :content="pushHistory.content"></u-parse>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				content: '',
				pushTemplateId: '',
				pushHistory: {}
			}
		},
		methods: {

		},
		onLoad: function(option) { //option为object类型，会序列化上个页面传递的参数
			this.pushTemplateId = option.id;
		},
		mounted() {
			let token = uni.getStorageSync('token');
			if (!token) {
				return;
			}
			uni.$u.http.get(`${this.urlConfig.appServerPrefix}/pushHistory/selectById`, {
				header: {
					"token": token
				},
				params: {
					id: this.pushTemplateId
				}
			}).then(res => {
				if (!res || !res.data || !res.data.extend || !res.data.extend.pushHistory) {
					return;
				}
				this.pushHistory = res.data.extend.pushHistory;
			}).catch(err => {
				console.log(err)
			});
		}
	}
</script>

<style lang="scss" scoped>
	.u-content {
		padding: 24rpx;
	}

	.push-title {
		font-size: 40rpx;
		font-weight: bold;
		color: rgb(48, 49, 51);
	}

	.push-msg {
		font-size: 30rpx;
		font-weight: normal;
		color: #909399;
		margin-right: 30rpx;
	}
	
	.push-header{
		margin-top: 15rpx;
	}
</style>
